import logging
from logging.handlers import RotatingFileHandler

LOG_PATH = './enclosure/mylog.log'


def get_logger():
    _logger = logging.getLogger("shopee")
    _logger.setLevel(level=logging.INFO)
    handler = RotatingFileHandler(filename=LOG_PATH, maxBytes=15 * 1024 * 1024, backupCount=3)
    handler.setLevel(logging.INFO)

    formatter = logging.Formatter('%(asctime)s %(funcName)s<%(lineno)d> ---> %(levelname)s:%(message)s')
    handler.setFormatter(formatter)
    _logger.addHandler(handler)

    return _logger


logger = get_logger()
